package io.dogstudio.apt.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * TODO 类描述
 *
 * @author HB.cby
 * @date 2020-10-28
 **/
public class ProxyTest {
	Xiaoming xiaoming = new Xiaoming();

	public void dynamicProxyTest() {
		// 动态代理
		SayHello p;
		p = (SayHello) Proxy
				.newProxyInstance(getClass().getClassLoader(), xiaoming.getClass().getInterfaces(),
						(InvocationHandler) (o, method, objects) -> method
								.invoke(xiaoming, objects));
		p.sayHello("tt");
	}
}
